package Exception;

import java.io.UnsupportedEncodingException;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
//import org.apache.commons.logging.LogFactory;
public class Main {
    public static void main(String[] args) {
//        try {
//            int[] a = new int[5];
//            a[5] = 10;
//        } catch (ArrayIndexOutOfBoundsException e) {
//            System.out.println(e.getMessage());
//        }finally {
//            Objects.requireNonNull(System.out).println("finally");
//        }
        Logger logger = Logger.getLogger(Main.class.getName());
        logger.info("Start process...");
        try {
            "".getBytes("invalidCharsetName");
        } catch (UnsupportedEncodingException e) {
          logger.log(Level.SEVERE, "Caught an UnsupportedEncodingException", e);
//            TODO:使用logger.severe() 打印异常
        } logger.info("Process end.");
    }
}
